<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /* 一个父类中有money(钱) cars(车) house(房) company(公司) 属性,有管理(manage)的方法,子类要继承父类中的属性和方法 */

    class Parent {
        constructor(money, cars, house, company) {
            this.money = money;
            this.cars = cars;
            this.house = house;
            this.company = company;
        }

        // 管理方法
        manage() {
            console.log(`${this.money}, ${this.cars}, ${this.house}, ${this.company}`);
        }
    }

    class Son extends Parent {
        constructor(money, cars, house, company, action) {
            // 继承父类属性
            super(money, cars, house, company);
            // 添加自己的属性
            this.action = action;
        }

        // 自己的方法
        manage() {
            // 继承父类的方法
            super.manage();
            console.log(`自己的方法 ${this.action}`);
        }
    }

    son = new Son(10000000, 10, '**房', '**公司', '**子公司');
    son.manage();
</script>
</html>